{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "model_deploy.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "model_deploy.common.labels" -}}
helm.sh/chart: {{ include "model_deploy.chart" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
master Selector labels
*/}}
{{- define "model_deploy.master.selectorLabels" -}}
app.kubernetes.io/name: {{ .Chart.Name }}-master
app.kubernetes.io/instance: {{ .Release.Name }}-master
{{- end }}

{{/*
worker Selector labels
*/}}
{{- define "model_deploy.worker.selectorLabels" -}}
app.kubernetes.io/name: {{ .Chart.Name }}-worker
app.kubernetes.io/instance: {{ .Release.Name }}-worker
{{- end }}

{{/*
master labels
*/}}
{{- define "model_deploy.master.labels" -}}
{{ include "model_deploy.common.labels" . }}
{{ include "model_deploy.master.selectorLabels" . }}
{{- end }}


{{/*
worker labels
*/}}
{{- define "model_deploy.worker.labels" -}}
{{ include "model_deploy.common.labels" . }}
{{ include "model_deploy.worker.selectorLabels" . }}
{{- end }}